import VueRouter from 'vue-router'
import Vue from 'vue'


const Home = () => import('views/home/Home')
const City = () => import('views/city/City')
const Msite = () => import('views/msite/Msite')
const Food = () => import('views/food/Food')
const Shop = () => import('views/shop/Shop')
const ShopDetail = () => import('views/shop/childComps/childComps/ShopDetail')
const ShopSafe = () => import('views/shop/childComps/childComps/childComps/childComps/ShopSafe')
const ShopFoodDetail = () => import('views/shop/childComps/childComps/childComps/ShopFoodDetail')

const Login = () => import('views/login/Login')
const Profile = () => import('views/profile/Profile')
const ProfileInfo = () => import('views/profile/childComps/childComps/ProfileInfo')
const SetUserName = () => import('views/profile/childComps/childComps/childComps/childComps/SetUserName')
const Address = () => import('views/profile/childComps/childComps/childComps/childComps/Address')
const AddressMainAdd = () => import('views/profile/childComps/childComps/childComps/childComps/childComps/childComps/AddressMainAdd')
const AddressMainAddDetail = () => import('views/profile/childComps/childComps/childComps/childComps/childComps/childComps/childComps/AddressMainAddDetail')

const Forget = () => import('views/forget/Forget')

const Points = () => import('views/points/Points')
const PointsDetail = () => import('views/points/childComps/childComps/PointsDetail')
const Benefit = () => import('views/benefit/Benefit')
const BenefitHbDescription = () => import('views/benefit/childComps/childComps/BenefitHbDescription')
const BenefitHbHistory = () => import('views/benefit/childComps/childComps/BenefitHbHistory')
const BenefitExchange = () => import('views/benefit/childComps/childComps/BenefitExchange')
const BenefitCoupon = () => import('views/benefit/childComps/childComps/BenefitCoupon')
const BenefitCommend = () => import('views/benefit/childComps/childComps/BenefitCommend')
const Balance = () => import('views/balance/Balance')
const BalancePanelDetail = () => import('views/balance/childComps/childComps/BalancePanelDetail')

const Download = () => import('views/download/Download')

const Order = () => import('views/order/Order')
const OrderDetail = () => import('views/order/childComps/childComps/OrderDetail')
const Vipcard = () => import('views/vipcard/Vipcard')
const VipDescription = () => import('views/vipcard/childComps/childComps/VipDescription')
const VipcardUseCart = () => import('views/vipcard/childComps/childComps/VipcardUseCart')
const VipcardInvoiceRecord = () => import('views/vipcard/childComps/childComps/VipcardInvoiceRecord')

const ConfirmOrder = () => import('views/confirmOrder/ConfirmOrder')
const Payment = () => import('views/confirmOrder/childComps/childComps/Payment')
const Remark = () => import('views/confirmOrder/childComps/childComps/Remark')
const Invoice = () => import('views/confirmOrder/childComps/childComps/Invoice')
const ChooseAddress = () => import('views/confirmOrder/childComps/childComps/ChooseAddress')
const AddAddress = () => import('views/confirmOrder/childComps/childComps/childComps/AddAddress')
const SearchAddress = () => import('views/confirmOrder/childComps/childComps/childComps/childComps/SearchAddress')

const Service = () => import('views/service/Service')
const ServiceQuestionDetail = () => import('views/service/childComps/childComps/ServiceQuestionDetail')

const Search = () => import('views/search/Search')
Vue.use(VueRouter)


const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/city/:id',
    component: City
  },
  {
    path: '/msite',
    component: Msite
  },
  {
    path: '/food',
    component: Food
  },
  {
    path: '/shop',
    component: Shop,
    children: [
      {
        path: 'shopDetail',
        component: ShopDetail,
        children: [
          {
            path: 'shopSafe',
            component: ShopSafe
          }
        ]
      },
      {
        path: 'foodDetail',
        component: ShopFoodDetail
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/profile',
    component: Profile,
    children: [
      {
        path: 'info',
        component: ProfileInfo,
        children: [
          {
            path: 'setusername',
            component: SetUserName
          },
          {
            path: 'address',
            component: Address,
            children: [
              {
                path: 'add',
                component: AddressMainAdd,
                children: [
                  {
                    path: 'addDetail',
                    component: AddressMainAddDetail
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  {
    path: '/forget',
    component: Forget
  },
  {
    path: '/points',
    component: Points,
    children: [
      {
        path: 'detail',
        component: PointsDetail
      }
    ]
  },
  {
    path: '/benefit',
    component: Benefit,
    children: [
      {
        path: 'hbDescription',
        component: BenefitHbDescription
      },
      {
        path: 'hbHistory',
        component: BenefitHbHistory
      },
      {
        path: 'exchange',
        component: BenefitExchange
      },
      {
        path: 'coupon',
        component: BenefitCoupon
      },
      {
        path: 'commend',
        component: BenefitCommend
      }
    ]
  },
  {
    path: '/balance',
    component: Balance,
    children: [
      {
        path: 'detail',
        component: BalancePanelDetail
      }
    ]
  },
  {
    path: '/download',
    component: Download
  },
  {
    path: '/order',
    component: Order,
    children: [
      {
        path: 'orderDetail',
        component: OrderDetail
      }
    ]
  },
  {
    path: '/vipcard',
    component: Vipcard,
    children: [
      {
        path: 'vipDescription',
        component: VipDescription
      },
      {
        path: 'useCart',
        component: VipcardUseCart
      },
      {
        path: 'invoiceRecord',
        component: VipcardInvoiceRecord
      }
    ]
  },
  {
    path: '/confirmOrder',
    component: ConfirmOrder,
    children: [
      {
        path: 'payment',
        component: Payment
      },
      {
        path: 'chooseAddress',
        component: ChooseAddress,
        children: [
          {
            path: 'addAddress',
            component: AddAddress,
            children: [
              {
                path: 'searchAddress',
                component: SearchAddress
              }
            ]
          }
        ]
      },
      {
        path: 'remark',
        component: Remark
      },
      {
        path: 'invoice',
        component: Invoice
      }
    ]
  },
  {
    path: '/service',
    component: Service,
    children: [
      {
        path: 'questionDetail',
        component: ServiceQuestionDetail
      }
    ]
  },
  {
    path: '/search',
    component: Search
  }
]
const router = new VueRouter({
  routes,
  mode: 'history'
})
// router.beforeEach((to, from, next) => {
//   next()
// })


export default router